<template>
    <div>foo

        id: {{ id }}
    </div>
</template>

<script>
    export default {
        props: ["id"],
        name: "Foo",
        beforeRouteEnter: (to, from, next)=>{
            console.log("Enter");
            next(vm => {
                vm.getData();
            });
        },
        beforeRouteLeave: (to, from, next)=>{
            console.log("Leave");
            next();
        },
        methods: {
            getData: function(){
                this.axios({
                    method: 'get',
                    url: "http://localhost:8080/static/mock/data.json"
                }).then(function(response){
                    console.log(response);
                })
            }
        }
    }
</script>